GAE on GO

1. Download the Google App Engine SDK

Link : GAE SDK

目標安裝在MAC

Go requires Python 2.7.x; don’t use a higher version. (The Go SDK uses tools from the App Engine Python SDK, so Python is required.) Make sure Python 2.7 is installed on your machine using the following command:

/usr/bin/env python -V

先使用/usr/bin/env python -V確認版本在2.7.x

然後分別在$HOME/.profile$HOME/.bashrc加入export PATH=/path/to/go_appengine:$PATH

範例:

我的GO GAE放在/Applications/go_appengine/

因此要填入的是export PATH=/Applications/go_appengine:$PATH

Read More

Android KIOSK Mode

IDEA:

  • 只有跑特定一隻客製的APP
  • 避免其他APP執行(除了白名單的APP)

General requirements for such applications

  • 只允許單一APP執行
  • 只能聯絡白名單的聯絡人(透過電話或SMS)。Only whitelisted contacts are allowed to be contacted (via Phone or SMS)
  • 只有白名單APP可以被使用
  • 追蹤APP安裝及反安裝
  • Disable status bar.
Read More

IOS Autolayout

IOS 常用基本型態

NSString

宣告方式

1
2
NSString *str1 = @"Log : 123";                                    // Log : 123
NSString *str2 = [NSString stringWithFormat:@"Log : %d",456]; // Log : 456
Read More

Git Submodule

Git submodule format:

git submodule add <repository> [<path>]

Submodule Link:

Subtree Link:

CI 工具

先看可以支援的語言

\ Drone Travis
相同 C / C++
Go
Haskell (New)
Groovy (New)
Java
Node.js
PHP (Beta)
Python (Beta)
Ruby (Beta)
Scala (New)
C / C++
Go
Haskell
Groovy
Java
JavaScript (with Node.js)
PHP
Python
Ruby
Scala
不同 Dart Android
Clojure
Erlang
Objective-C
Perl
Read More

一個成功的Git分支模型(心得)

成功的Git分支模型

Read More

Testing JUnit

下面是一個簡單的計算機程式

Calculator.javalink
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.zjw.junit4;

public class Calculator {

public int plus(int x, int y) {
return x + y;
}

public int subtraction(int x, int y) {
return x - y;
}

public int multiplication(int x, int y) {
return x * y;
}

public int division(int x, int y) {
return x / y;
}

}
Read More

Android Service 回收問題

最近需要寫一隻常駐的Service,但是印象中之前曾經有稍微眼尖看到,在記憶體不足的情況之下,Android會依照他特定的順序去回收資源,剛好Service又正好是Android回收清單的前幾名,既要常駐Service,那就是得要讓Service活得久一點。

How to restart a Service after getting Killed by apps like “Advanced Task Killer”?

這篇提到的方式是透過在onStartCommand回傳START_STICKY,讓Service被砍了之後,能夠自行重新開啟

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    return START_STICKY;
}
Read More

Android Custom Permission

主要成員:

  • Permission : com.yume190.provider.permission.XXX_API
  • Action : Action.StartService

將service的exportedenabled皆設為true,並透過設定intent-filter去接收特定的action。

宣告方式

CalleeManifest.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<permission-group
android:name="com.yume190.provider.permissions"
android:label="Permission 主標題"
/>


<permission
android:name="com.yume190.provider.permission.XXX_API"
android:permissionGroup="com.yume190.provider.permissions"
android:protectionLevel="normal"
android:label="Permission 副標題"
/>


<application>
<service
android:name="MyService"
android:exported="true"
android:enabled="true"
android:permission="com.yume190.provider.permission.XXX_API"
>

<intent-filter>
<action android:name="Action.StartService" />
</intent-filter>
</service>
</application>
Read More